package org.esky.xml;

import java.io.File;
import java.util.List;

import org.jdom.Element;
import org.jdom.input.SAXBuilder;

public class JdomXMLReader {

	/**
	 * JDOM方式 
	 * 
	 * @Title: reader
	 * @Description: TODO
	 * @return: void
	 */
    @SuppressWarnings("rawtypes")
	public static void reader(String path) {  
        long lasting = System.currentTimeMillis();  
        try {  
            SAXBuilder builder = new SAXBuilder();  
            org.jdom.Document doc = builder.build(new File(path));  
            Element foo = doc.getRootElement();  
            List allChildren = foo.getChildren();  
            for (int i = 0; i < allChildren.size(); i++) {  
                System.out.println("|| Name:  |" + ((Element) allChildren.get(i)).getChild("name").getText());  
                System.out.println("||Space:  |" + ((Element) allChildren.get(i)).getChild("space").getText());  
                System.out.println("-------------------------------------------------");            }  
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
        System.out.println("JDOM RUNTIME：" + (System.currentTimeMillis() - lasting) + " MS");  
    }  
}
